/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao.Impl;

import dao.AccountDao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ZZ
 */
public class AccountDaoImpl extends BaseDao implements AccountDao{

    @Override
    public int update(String dealType, int petID, int sellerID, int buyerID, double price, Date dealTime) {
        int r=0;
        try {
            Connection con=BaseDao.getConnection();
            PreparedStatement ppst=con.prepareStatement("insert into account(DEAL_TYPE,PET_ID,SELLER_ID,BUYER_ID,PRICE,DEAL_TIME) VALUES(?,?,?,?,?,?)");
            ppst.setString(1,dealType );
            ppst.setInt(2,petID);
            ppst.setInt(3,sellerID);
            ppst.setInt(4,buyerID);
            ppst.setDouble(5,price);
            ppst.setDate(6,dealTime);
            r=ppst.executeUpdate();
            ppst.close();
            con.close();
        } catch (SQLException ex) {
            Logger.getLogger(PetDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return r;
    }

    
    
}
